<%@ page import="java.sql.DriverManager" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.Statement" %>
<%@ page import="com.gzsz.util.DBUtil" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    //
    String id=request.getParameter("id");
    DBUtil dbUtil=new DBUtil();
//    //    1：加载驱动（加载我们代码里面）
//    Class.forName("com.mysql.cj.jdbc.Driver");
////    2：创建连接
//    String url = "jdbc:mysql://localhost:3306/medicald?serverTimezone=Asia/Shanghai";
//    String user = "root";
//    String password = "123456";
//    Connection connection= DriverManager.getConnection(url,user,password );
////            out.println(connection);
////    3：创建命令对象
//    Statement statement=connection.createStatement();
//            4：执行命令对象，返回结果
//    4-1：查询
    String sql="delete from yihu where id="+id+";";
    System.out.println(sql);
    int i=dbUtil.executeUpdateBySQL(sql);
    if (i>0){
        response.sendRedirect("medical-table.jsp");
    }else {
        out.println("删除失败");
    }
%>
